﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("请输入一个正整数：");
            string input = Console.ReadLine();

            if (int.TryParse(input, out int number) && number > 1)
            {
                List<int> primeFactors = GetPrimeFactors(number);
                Console.WriteLine($"数字 {number} 的素数因子为：{string.Join(", ", primeFactors)}");
            }
            else
            {
                Console.WriteLine("请输入有效的正整数大于1。");
            }

            Console.ReadLine();
        }

        static List<int> GetPrimeFactors(int n)
        {
            var factors = new List<int>();

            for (int i = 2; i <= n; i++)
            {
                while (n % i == 0)
                {
                    factors.Add(i);
                    n /= i;
                }
            }

            return factors;
        }
    }

}
